<%@page import="java.util.Locale"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Collections"%>
<%@page import="javax.cache.CacheException"%>
<%@page import="javax.cache.CacheManager"%>
<%@page import="javax.cache.Cache"%>
<%@page import="com.googlecode.objectify.Query"%>
<%@page import="model.Articles"%>
<%
Articles art = (Articles) request.getAttribute("art");
Query<Articles> list = (Query<Articles>) request.getAttribute("list");
SimpleDateFormat dt = new SimpleDateFormat("MM-dd-yyyy"); 
ResourceBundle resource = ResourceBundle.getBundle("language",
		new Locale("en"));
String title = art.getTitle()!=null?art.getTitle().getValue():"";
String des = art.getContent()!=null?art.getContent().getValue().replaceAll("\\<.*?>",""):"";
if(des.length()>250)
	des = des.substring(0,150);
String keyword = art.getAuthor()+","+art.getAuthorAlias()+","+art.getStrdate();

%>
<% request.setCharacterEncoding("utf-8"); %>
<jsp:include page="/layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=des %>"/>
	<jsp:param name="keywords" value="<%=keyword %>"/>
</jsp:include>

	<div class="bd">
		<div class="bdl">
			<%@ include file='/adv/250x250.jsp'%>
			<h2><%=resource.getString("older_articles") %></h2>
			<ul>
				<%
				for (Articles ar: list) {
				%>
					<li><a href="/article/<%=ar.getAlias()%>"><%=ar.getTitle().getValue() %></a></li>
				<%
				}
				%>
			</ul>
		</div>
		<div class="bdr">
			<h1><%=art.getTitle().getValue() %></h1>
			<p class="at"><%=resource.getString("author") %>: <a href="/author/<%=art.getAuthorAlias()%>"><%=art.getAuthor() %></a>  | 
			<%=resource.getString("date") %>: <a href="/date/<%=dt.format(new Date(art.getDate()))%>"><%=dt.format(new Date(art.getDate()))%></a></p>
			<hr size="1"/>
			<div class="ri ad">
				<%@ include file='/adv/250x250.jsp'%>
			</div>
			<p>
				<%=art.getContent().getValue() %>
			</p>
			<p>
				<a href="http://jpgoarticles.appspot.com/article/<%=art.getAlias()%>" target="_blank"><img src="/images/jp.png" alt="japan"/></a>  &nbsp;
				<a href="http://ptgoarticles.appspot.com/article/<%=art.getAlias()%>" target="_blank"><img src="/images/pt.png" alt="Portuguese"/></a> &nbsp;
				<a href="http://esgoarticles.appspot.com/article/<%=art.getAlias()%>" target="_blank"><img src="/images/es.png" alt="Spanish"/></a> 
			</p>
		</div>
	</div>

<%@ include file='/layout/footer.jsp'%>			